home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: netcom.com!milyng
- From: mikael@pobox.com (Mikael Lyngvig)
- Subject: Re: error checking for int
- Message-ID: <milyngDM8Hvn.Jr5@netcom.com>
- Sender: milyng@netcom9.netcom.com
- Organization: Hacker's Paradise, Inc.
- X-Newsreader: WinVN 0.99.7
- References: <Pine.SUN.3.91.960203120230.12797A-100000@chip.bgsu.edu>
- Date: Sun, 4 Feb 1996 04:30:59 GMT
-
- In article <Pine.SUN.3.91.960203120230.12797A-100000@chip.bgsu.edu>,
- turner@chip.bgsu.edu says...
-
- > cout>>"\nEnter a number from 1-20: ";
- > cin<<something[0];
-
- Hmm. Unless it is a typo, the problem is that you're reversing the operators.
- The above should read:
-
- cout << "\nEnter a number from 1-20: ";
- cin >> something[0];
-
- I.e., "<<" should be ">>" and vice versa.
-
- If that's not the problem, it may be that you need to dig a bit in the books
- and find out how to query the stream objects for errors - I seem to recall
- there's a member function called fail(). It might be useful (I don't use
- streams myself, so I am not sure).
-
-
- Mikael
-
-